<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>octant.depths</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="octant-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="octant-module.html">Package&nbsp;octant</a> ::
        Module&nbsp;depths
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="octant.depths-module.html">Module octant.depths</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment"># encoding: utf-8</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-docstring">'''Various vertical coordinates</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-docstring">Presently, only ocean s-coordinates are supported. Future plans will be to</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-docstring">include all of the vertical coordinate systems defined by the CF conventions.</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-docstring">'''</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-name">__docformat__</tt> <tt class="py-op">=</tt> <tt class="py-string">"restructuredtext en"</tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">numpy</tt> <tt class="py-keyword">as</tt> <tt class="py-name">np</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"> </tt>
<a name="s_coordinate"></a><div id="s_coordinate-def"><a name="L12"></a><tt class="py-lineno"> 12</tt> <a class="py-toggle" href="#" id="s_coordinate-toggle" onclick="return toggle('s_coordinate');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="octant.depths.s_coordinate-class.html">s_coordinate</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="s_coordinate-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="s_coordinate-expanded"><a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line">    <tt class="py-docstring">"""return an object that can be indexed to return depths</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-docstring">    Parameters</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-docstring">    ----------</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-docstring">    h : array_like</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-docstring">        An array of depths, either one- or two-dimensional.</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-docstring">    hc : float</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-docstring">        The critical depth.  Presently hc &lt; h.min() must be true.</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-docstring">    theta_b : float</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-docstring">        A parameter (0.0 &lt; theta_b &lt; 1.0) that says whether the coordinate</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-docstring">        will be focused at the surface (theta_b -&gt; 1.0) or split evenly</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-docstring">        between surface and bottom (theta_b -&gt; 0).</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-docstring">    theta_s : float</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-docstring">        A parameter (typically 0.0 &lt;= theta_s &lt; 5.0) that defines the amount</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"><tt class="py-docstring">        of grid focising. A higher value for theta_s will focus the grid more.</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-docstring">    N : int</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-docstring">        The number of rho/tracer-points in the vertical.</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-docstring">    zeta: array_like, optional</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-docstring">        The free surface, must be the same size as h.</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"><tt class="py-docstring">    Returns</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line"><tt class="py-docstring">    -------</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line"><tt class="py-docstring">    z : object</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line"><tt class="py-docstring">        z is an scoord object that contains as attributes all of the input</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line"><tt class="py-docstring">        values. The actual depths may be retreived by indexing z. Note that</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line"><tt class="py-docstring">        the values of zeta are not calculated until z is indexed, so a netCDF</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line"><tt class="py-docstring">        variable for zeta may be passed, even if the file is large, as only</tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line"><tt class="py-docstring">        the values that are required will be retrieved from the file.</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="s_coordinate.__init__"></a><div id="s_coordinate.__init__-def"><a name="L43"></a><tt class="py-lineno"> 43</tt> <a class="py-toggle" href="#" id="s_coordinate.__init__-toggle" onclick="return toggle('s_coordinate.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="octant.depths.s_coordinate-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">h</tt><tt class="py-op">,</tt> <tt class="py-param">hc</tt><tt class="py-op">,</tt> <tt class="py-param">theta_b</tt><tt class="py-op">,</tt> <tt class="py-param">theta_s</tt><tt class="py-op">,</tt> <tt class="py-param">N</tt><tt class="py-op">,</tt> <tt class="py-param">grid</tt><tt class="py-op">=</tt><tt class="py-string">'rho'</tt><tt class="py-op">,</tt> <tt class="py-param">zeta</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="s_coordinate.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="s_coordinate.__init__-expanded"><a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">hc</tt> <tt class="py-op">=</tt> <tt class="py-name">hc</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">h</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">asarray</tt><tt class="py-op">(</tt><tt class="py-name">h</tt><tt class="py-op">)</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_b</tt> <tt class="py-op">=</tt> <tt class="py-name">theta_b</tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_s</tt> <tt class="py-op">=</tt> <tt class="py-name">theta_s</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">N</tt> <tt class="py-op">=</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-name">N</tt><tt class="py-op">)</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-0" class="py-name" targets="Module octant.grid=octant.grid-module.html"><a title="octant.grid" class="py-name" href="#" onclick="return doclink('link-0', 'grid', 'link-0');">grid</a></tt> <tt class="py-op">=</tt> <tt id="link-1" class="py-name"><a title="octant.grid" class="py-name" href="#" onclick="return doclink('link-1', 'grid', 'link-0');">grid</a></tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line">         </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-2" class="py-name"><a title="octant.grid" class="py-name" href="#" onclick="return doclink('link-2', 'grid', 'link-0');">grid</a></tt> <tt class="py-op">==</tt> <tt class="py-string">'w'</tt><tt class="py-op">:</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">N</tt> <tt class="py-op">+=</tt> <tt class="py-number">1</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">         </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">zeta</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">zeta</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">zeros</tt><tt class="py-op">(</tt><tt class="py-name">h</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">)</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">zeta</tt> <tt class="py-op">=</tt> <tt class="py-name">zeta</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line">         </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">        <tt class="py-name">hdim</tt> <tt class="py-op">=</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">h</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">)</tt> </tt>
</div><a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line"> </tt>
<a name="s_coordinate._get_sc"></a><div id="s_coordinate._get_sc-def"><a name="L61"></a><tt class="py-lineno"> 61</tt> <a class="py-toggle" href="#" id="s_coordinate._get_sc-toggle" onclick="return toggle('s_coordinate._get_sc');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="octant.depths.s_coordinate-class.html#_get_sc">_get_sc</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="s_coordinate._get_sc-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="s_coordinate._get_sc-expanded"><a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-3" class="py-name"><a title="octant.grid" class="py-name" href="#" onclick="return doclink('link-3', 'grid', 'link-0');">grid</a></tt> <tt class="py-op">==</tt> <tt class="py-string">'rho'</tt><tt class="py-op">:</tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line">            <tt id="link-4" class="py-name" targets="Variable octant.depths.s_coordinate.sc=octant.depths.s_coordinate-class.html#sc,Variable octant.ocean.depths.Depths.sc=octant.ocean.depths.Depths-class.html#sc"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-4', 'sc', 'link-4');">sc</a></tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">linspace</tt><tt class="py-op">(</tt><tt class="py-op">-</tt><tt class="py-number">1.0</tt><tt class="py-op">,</tt> <tt class="py-number">0.0</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">N</tt><tt class="py-op">+</tt><tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line">            <tt id="link-5" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-5', 'sc', 'link-4');">sc</a></tt> <tt class="py-op">=</tt> <tt class="py-number">0.5</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt id="link-6" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-6', 'sc', 'link-4');">sc</a></tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt><tt class="py-op">+</tt><tt id="link-7" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-7', 'sc', 'link-4');">sc</a></tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line">            <tt id="link-8" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-8', 'sc', 'link-4');">sc</a></tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">linspace</tt><tt class="py-op">(</tt><tt class="py-op">-</tt><tt class="py-number">1.0</tt><tt class="py-op">,</tt> <tt class="py-number">0.0</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">N</tt><tt class="py-op">)</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt id="link-9" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-9', 'sc', 'link-4');">sc</a></tt> </tt>
</div><a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line">     </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">    <tt id="link-10" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-10', 'sc', 'link-4');">sc</a></tt> <tt class="py-op">=</tt> <tt class="py-name">property</tt><tt class="py-op">(</tt><tt id="link-11" class="py-name" targets="Method octant.depths.s_coordinate._get_sc()=octant.depths.s_coordinate-class.html#_get_sc,Method octant.ocean.depths.Depths._get_sc()=octant.ocean.depths.Depths-class.html#_get_sc"><a title="octant.depths.s_coordinate._get_sc
octant.ocean.depths.Depths._get_sc" class="py-name" href="#" onclick="return doclink('link-11', '_get_sc', 'link-11');">_get_sc</a></tt><tt class="py-op">)</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line">     </tt>
<a name="s_coordinate._get_Cs"></a><div id="s_coordinate._get_Cs-def"><a name="L71"></a><tt class="py-lineno"> 71</tt> <a class="py-toggle" href="#" id="s_coordinate._get_Cs-toggle" onclick="return toggle('s_coordinate._get_Cs');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="octant.depths.s_coordinate-class.html#_get_Cs">_get_Cs</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="s_coordinate._get_Cs-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="s_coordinate._get_Cs-expanded"><a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">-</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_b</tt><tt class="py-op">)</tt><tt class="py-op">*</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name" targets="Variable octant.ocean.depths.sinh=octant.ocean.depths-module.html#sinh,Variable octant.ocean.sinh=octant.ocean-module.html#sinh,Variable octant.ocean.state.sinh=octant.ocean.state-module.html#sinh,Variable octant.ocean.step3d_t.sinh=octant.ocean.step3d_t-module.html#sinh,Variable octant.ocean.time.sinh=octant.ocean.time-module.html#sinh,Variable octant.ocean.velocity.sinh=octant.ocean.velocity-module.html#sinh"><a title="octant.ocean.depths.sinh
octant.ocean.sinh
octant.ocean.state.sinh
octant.ocean.step3d_t.sinh
octant.ocean.time.sinh
octant.ocean.velocity.sinh" class="py-name" href="#" onclick="return doclink('link-12', 'sinh', 'link-12');">sinh</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_s</tt><tt class="py-op">*</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-13" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-13', 'sc', 'link-4');">sc</a></tt><tt class="py-op">)</tt><tt class="py-op">/</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name"><a title="octant.ocean.depths.sinh
octant.ocean.sinh
octant.ocean.state.sinh
octant.ocean.step3d_t.sinh
octant.ocean.time.sinh
octant.ocean.velocity.sinh" class="py-name" href="#" onclick="return doclink('link-14', 'sinh', 'link-12');">sinh</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_s</tt><tt class="py-op">)</tt> \ </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line">                <tt class="py-op">+</tt> <tt class="py-number">0.5</tt><tt class="py-op">*</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_b</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt id="link-15" class="py-name" targets="Variable octant.ocean.depths.tanh=octant.ocean.depths-module.html#tanh,Variable octant.ocean.state.tanh=octant.ocean.state-module.html#tanh,Variable octant.ocean.step3d_t.tanh=octant.ocean.step3d_t-module.html#tanh,Variable octant.ocean.tanh=octant.ocean-module.html#tanh,Variable octant.ocean.time.tanh=octant.ocean.time-module.html#tanh,Variable octant.ocean.velocity.tanh=octant.ocean.velocity-module.html#tanh"><a title="octant.ocean.depths.tanh
octant.ocean.state.tanh
octant.ocean.step3d_t.tanh
octant.ocean.tanh
octant.ocean.time.tanh
octant.ocean.velocity.tanh" class="py-name" href="#" onclick="return doclink('link-15', 'tanh', 'link-15');">tanh</a></tt><tt class="py-op">(</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_s</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-16', 'sc', 'link-4');">sc</a></tt><tt class="py-op">+</tt><tt class="py-number">0.5</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">-</tt> \ </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line">                                             <tt class="py-name">np</tt><tt class="py-op">.</tt><tt id="link-17" class="py-name"><a title="octant.ocean.depths.tanh
octant.ocean.state.tanh
octant.ocean.step3d_t.tanh
octant.ocean.tanh
octant.ocean.time.tanh
octant.ocean.velocity.tanh" class="py-name" href="#" onclick="return doclink('link-17', 'tanh', 'link-15');">tanh</a></tt><tt class="py-op">(</tt><tt class="py-number">0.5</tt><tt class="py-op">*</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_s</tt> <tt class="py-op">)</tt><tt class="py-op">)</tt>  \ </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line">                                  <tt class="py-op">/</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name"><a title="octant.ocean.depths.tanh
octant.ocean.state.tanh
octant.ocean.step3d_t.tanh
octant.ocean.tanh
octant.ocean.time.tanh
octant.ocean.velocity.tanh" class="py-name" href="#" onclick="return doclink('link-18', 'tanh', 'link-15');">tanh</a></tt><tt class="py-op">(</tt><tt class="py-number">0.5</tt><tt class="py-op">*</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">theta_s</tt><tt class="py-op">)</tt> </tt>
</div><a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line">     </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line">    <tt id="link-19" class="py-name" targets="Variable octant.depths.s_coordinate.Cs=octant.depths.s_coordinate-class.html#Cs,Variable octant.ocean.depths.Depths.Cs=octant.ocean.depths.Depths-class.html#Cs"><a title="octant.depths.s_coordinate.Cs
octant.ocean.depths.Depths.Cs" class="py-name" href="#" onclick="return doclink('link-19', 'Cs', 'link-19');">Cs</a></tt> <tt class="py-op">=</tt> <tt class="py-name">property</tt><tt class="py-op">(</tt><tt id="link-20" class="py-name" targets="Method octant.depths.s_coordinate._get_Cs()=octant.depths.s_coordinate-class.html#_get_Cs,Method octant.ocean.depths.Depths._get_Cs()=octant.ocean.depths.Depths-class.html#_get_Cs"><a title="octant.depths.s_coordinate._get_Cs
octant.ocean.depths.Depths._get_Cs" class="py-name" href="#" onclick="return doclink('link-20', '_get_Cs', 'link-20');">_get_Cs</a></tt><tt class="py-op">)</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line">     </tt>
<a name="s_coordinate.__getitem__"></a><div id="s_coordinate.__getitem__-def"><a name="L79"></a><tt class="py-lineno"> 79</tt> <a class="py-toggle" href="#" id="s_coordinate.__getitem__-toggle" onclick="return toggle('s_coordinate.__getitem__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="octant.depths.s_coordinate-class.html#__getitem__">__getitem__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">key</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="s_coordinate.__getitem__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="s_coordinate.__getitem__-expanded"><a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-name">tuple</tt><tt class="py-op">)</tt> <tt class="py-keyword">and</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">zeta</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">)</tt> <tt class="py-op">&gt;</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">h</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">            <tt class="py-name">zeta</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">zeta</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">]</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line">            <tt class="py-name">res_index</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt id="link-21" class="py-name" targets="Module octant.slice=octant.slice-module.html"><a title="octant.slice" class="py-name" href="#" onclick="return doclink('link-21', 'slice', 'link-21');">slice</a></tt><tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-name">key</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">zeta</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">)</tt> <tt class="py-op">&gt;</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">h</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">            <tt class="py-name">zeta</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">zeta</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">]</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">            <tt class="py-name">res_index</tt> <tt class="py-op">=</tt> <tt id="link-22" class="py-name"><a title="octant.slice" class="py-name" href="#" onclick="return doclink('link-22', 'slice', 'link-21');">slice</a></tt><tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">            <tt class="py-name">zeta</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">zeta</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">            <tt class="py-name">res_index</tt> <tt class="py-op">=</tt> <tt class="py-name">key</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">         </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">h</tt><tt class="py-op">.</tt><tt class="py-name">ndim</tt> <tt class="py-op">==</tt> <tt class="py-name">zeta</tt><tt class="py-op">.</tt><tt class="py-name">ndim</tt><tt class="py-op">:</tt>       <tt class="py-comment"># Assure a time-dimension exists</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line">            <tt class="py-name">zeta</tt> <tt class="py-op">=</tt> <tt class="py-name">zeta</tt><tt class="py-op">[</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt id="link-23" class="py-name" targets="Variable octant.ocean.depths.newaxis=octant.ocean.depths-module.html#newaxis,Variable octant.ocean.newaxis=octant.ocean-module.html#newaxis,Variable octant.ocean.state.newaxis=octant.ocean.state-module.html#newaxis,Variable octant.ocean.step3d_t.newaxis=octant.ocean.step3d_t-module.html#newaxis,Variable octant.ocean.time.newaxis=octant.ocean.time-module.html#newaxis,Variable octant.ocean.velocity.newaxis=octant.ocean.velocity-module.html#newaxis"><a title="octant.ocean.depths.newaxis
octant.ocean.newaxis
octant.ocean.state.newaxis
octant.ocean.step3d_t.newaxis
octant.ocean.time.newaxis
octant.ocean.velocity.newaxis" class="py-name" href="#" onclick="return doclink('link-23', 'newaxis', 'link-23');">newaxis</a></tt><tt class="py-op">,</tt> <tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">         </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">        <tt class="py-name">ti</tt> <tt class="py-op">=</tt> <tt class="py-name">zeta</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">        <tt class="py-name">z</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">empty</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">ti</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">N</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">h</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">,</tt> <tt class="py-string">'d'</tt><tt class="py-op">)</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">n</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">ti</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt>  <tt class="py-name">k</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">N</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">                <tt class="py-name">z0</tt><tt class="py-op">=</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-24" class="py-name"><a title="octant.depths.s_coordinate.sc
octant.ocean.depths.Depths.sc" class="py-name" href="#" onclick="return doclink('link-24', 'sc', 'link-4');">sc</a></tt><tt class="py-op">[</tt><tt class="py-name">k</tt><tt class="py-op">]</tt><tt class="py-op">-</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-25" class="py-name"><a title="octant.depths.s_coordinate.Cs
octant.ocean.depths.Depths.Cs" class="py-name" href="#" onclick="return doclink('link-25', 'Cs', 'link-19');">Cs</a></tt><tt class="py-op">[</tt><tt class="py-name">k</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">*</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">hc</tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-26" class="py-name"><a title="octant.depths.s_coordinate.Cs
octant.ocean.depths.Depths.Cs" class="py-name" href="#" onclick="return doclink('link-26', 'Cs', 'link-19');">Cs</a></tt><tt class="py-op">[</tt><tt class="py-name">k</tt><tt class="py-op">]</tt><tt class="py-op">*</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">h</tt><tt class="py-op">;</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">                <tt class="py-name">z</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">,</tt><tt class="py-name">k</tt><tt class="py-op">,</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">z0</tt> <tt class="py-op">+</tt> <tt class="py-name">zeta</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">,</tt><tt class="py-op">:</tt><tt class="py-op">]</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt class="py-number">1.0</tt> <tt class="py-op">+</tt> <tt class="py-name">z0</tt><tt class="py-op">/</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">h</tt><tt class="py-op">)</tt><tt class="py-op">;</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">         </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">squeeze</tt><tt class="py-op">(</tt><tt class="py-name">z</tt><tt class="py-op">[</tt><tt class="py-name">res_index</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="octant-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1
    on Mon Apr 20 11:56:32 2009
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
